<?
//display section in functie de id (daca acesta este 0 atunci se adauga):
function display($id)
{
	if ($id==0)
	{
	?>
		<form action="" name="testQR" method="POST" enctype="multipart/form-data">       
			<table width="95%">
				<tr><td width="100">Name</td><td><input name="cname" type="text" value="" style="width:85%"></td></tr>
				<tr><td>CUI</td><td><input name="cui" type="text" value="" style="width:85%"></td></tr>
				<tr><td>J</td><td><input name="j" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Street</td><td><input name="street" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Nr</td><td><input name="nr" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Building</td><td><input name="building" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Floor</td><td><input name="floor" type="text" value="" style="width:85%"></td></tr>
				<tr><td>City</td><td><input name="city" type="text" value="" style="width:85%"></td></tr>
				<tr><td>County</td><td><input name="county" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Country</td><td><input name="country" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Postal code</td><td><input name="postalcode" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Bank</td><td><input name="bank" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Bank account</td><td><input name="bank_account" type="text" value="" style="width:85%"></td></tr>
				<tr><td>Logo</td><td><input type="file" name="userFile" id="userFile"></td></tr>
			  	<tr>
					<td><input type="submit" name="qr_add" value="Add" ></td>
					<td align="right"><input type="submit" name="qr_cancel" value="Cancel"></td>
				</tr>
			</table>
		</form>
	<?
	}
	else
	{
		//poate reusim sa facem transfer de variabile ca sa nu stresam db'ul...
		$result = returnQuery("select * from companies where id = ".$id.";",'');
		$row = mysql_fetch_assoc($result);
	?>
		<form action="" name="testQR" method="POST" enctype="multipart/form-data">    
			<table width="95%">
				<tr><td width="100">Name</td><td><input name="cname" type="text" value="<? echo $row['name'] ?>" style="width:85%"></td></tr>
				<tr><td>CUI</td><td><input name="cui" type="text" value="<? echo $row['cui'] ?>" style="width:85%"></td></tr>
				<tr><td>J</td><td><input name="j" type="text" value="<? echo $row['j'] ?>" style="width:85%"></td></tr>
				<tr><td>Street</td><td><input name="street" type="text" value="<? echo $row['street'] ?>" style="width:85%"></td></tr>
				<tr><td>Nr</td><td><input name="nr" type="text" value="<? echo $row['nr'] ?>" style="width:85%"></td></tr>
				<tr><td>Building</td><td><input name="building" type="text" value="<? echo $row['building'] ?>" style="width:85%"></td></tr>
				<tr><td>Floor</td><td><input name="floor" type="text" value="<? echo $row['floor'] ?>" style="width:85%"></td></tr>
				<tr><td>City</td><td><input name="city" type="text" value="<? echo $row['city'] ?>" style="width:85%"></td></tr>
				<tr><td>County</td><td><input name="county" type="text" value="<? echo $row['county'] ?>" style="width:85%"></td></tr>
				<tr><td>Country</td><td><input name="country" type="text" value="<? echo $row['country'] ?>" style="width:85%"></td></tr>
				<tr><td>Postal code</td><td><input name="postalcode" type="text" value="<? echo $row['postal_code'] ?>" style="width:85%"></td></tr>
				<tr><td>Bank</td><td><input name="bank" type="text" value="<? echo $row['bank'] ?>" style="width:85%"></td></tr>
				<tr><td>Bank account</td><td><input name="bank_account" type="text" value="<? echo $row['bank_account'] ?>" style="width:85%"></td></tr>
				<tr><td>Logo</td><td>
					<?
						//echo ("<img src='".$row['picture']."' width='20' height='20' />");
					?>
					<input type="file" name="userFile" id="userFile"></td></tr>
				<tr>
					<td>
						<input type="submit" name="qr_update" value="Update">
						<input type="submit" name="qr_del" value="Delete">
					</td>
					<td align="right"><input type="submit" name="qr_cancel" value="Cancel"></td>
				</tr>
				
			</table>
		</form>
	<?
	}
}
	

?>